/**
 * 购物车模型
 */
import Base from './base.js'
class Cart extends Base{
    constructor() {
    	super();
    }
	//购物车数量
	static async getCartSum(){
		const data = await Base.request({url:'cart/get_cart_sum'})
		Base.uniApi.setTabBarBadge({text:data.cart_num})
		return data		 
	}
	//加入购物车
	static async addCart(data){
		return await Base.request({
			url:'cart/add_cart',
			data:data,
			method:'POST',
			data_status:true
		  }) 
	}
	//购物车列表
	static async getCartList(){
		return await Base.request({url:'cart/get_cart_list'})
	}
	//单选
	static async setCartStatus(data){
		return await Base.request({url:'cart/set_cart_status',data:data,method:'PUT'})
	}
	//全选全不选
	static async setCartStatusAll(){
		return await Base.request({url:'cart/set_cart_status_all',method:'PUT'})
	}
	//购物车减或加
	static async setCartSubtract(data){
		return await Base.request({url:'cart/set_cart_subtract',data:data,method:'PUT'})
	}
	//删除
	static async cartDelete(){
		return await Base.request({url:'cart/cart_delete',method:'DELETE'})
	}
	//购物车提交订单页
	static async getCartSubmitOrder(){
		return await Base.request({url:'cart/get_cart_submit_order'})
	}
	//购物车提交订单支付
	static async submitCartOrderPay(data){
		return await Base.request({url:'cart/submit_cart_order_pay',data:data,method:'POST'})
	}
}
export default Cart